package ui;

import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;

public class ActionMenuItem extends JMenuItem implements CommandInterface {
	private static final long	serialVersionUID	= 1L;

	
	public ActionMenuItem(String tag) {
		super(tag);
	}
	@Override
	public void doAction() {
	    JFileChooser fileopen = new JFileChooser();
	    FileFilter filter = new FileNameExtensionFilter("c files", "c");
	    fileopen.addChoosableFileFilter(filter);

	    int ret = fileopen.showDialog(null, "Open file");

	    if (ret == JFileChooser.APPROVE_OPTION) {
	      File file = fileopen.getSelectedFile();
	      System.out.println(file);
	    }
	}
}
